package com.gxgeek.javabasic.dynamicproxy.cglib;

import com.gxgeek.javabasic.dynamicproxy.jdk.UserService;
import com.gxgeek.javabasic.dynamicproxy.jdk.UserServiceImpl;
import org.springframework.cglib.proxy.Enhancer;

/**
 * Created by Administrator on 2017/7/9.
 */
public class CGlibMain {

    public static void main(String[] args) {
        CglibProxy cglibProxy = new CglibProxy();

        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(UserServiceImpl.class);
        enhancer.setCallback(cglibProxy);

        UserService o = (UserService)enhancer.create();
        o.getName(1);
        o.getAge(1);

    }

}
